package com.itheima.bean;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class mains {
    public static void main(String[] args) {
        //通过AnnotationConfigApplicationContext不添加component等注解类也可以被创建bean对象
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Springtest1.class);
        Springtest1 ctxBean = (Springtest1)ctx.getBean("springtest1");
        System.out.println(ctxBean.cat());
        System.out.println(ctxBean);
        System.out.println(ctx.getBean(Dog.class));
        System.out.println("---------------");
        String[] names = ctx.getBeanDefinitionNames();
        for (String name:names) {
            System.out.println(name);
        }

    }
}
